import React , {Component} from 'react'

export default function formWrapper(Comp){
  return class formWrapper  extends Component{
    constructor(props){
      super(props)
      this.state={}
      this.handleChange= this.handleChange.bind(this)
    }
    componentWillReceiveProps(nextProps) {
      console.log('Current props: ', this.props);
      console.log('Next props: ', nextProps);
    }
    handleChange(key,val){
      this.setState({
        [key]:val
      })
    }
    render(){
      return <Comp state={this.state} handleChange={this.handleChange} {...this.props}></Comp>
    }
  }
}